
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>1.1UITableview相关面试题 · zhoufei-iosknowledges</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="zhoufei">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-anchors/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-donate/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    

        
    
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="shujutongbu.html" />
    
    
    <link rel="prev" href="ui.html" />
    

    
        <link rel="shortcut icon" href='../../source/images/favicon.jpg' type="image/x-icon">
    
    
        <link rel="bookmark" href='../../source/images/favicon.jpg' type="image/x-icon">
    
    
        <link rel="apple-touch-icon" href='../../source/images/apple-touch-icon.jpg'>
    
    
        
        <link rel="apple-touch-icon" sizes="120x120" href="../../source/images/apple-touch-icon.jpg">
        
        <link rel="apple-touch-icon" sizes="180x180" href="../../source/images/apple-touch-icon.jpg">
        
    

    <style>
    @media only screen and (max-width: 640px) {
        .book-header .hidden-mobile {
            display: none;
        }
    }
    </style>
    <script>
        window["gitbook-plugin-github-buttons"] = {"buttons":[{"user":"zhou415770319","repo":"iosKnowledges","type":"star","size":"small","count":true}]};
    </script>

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="http://www.feiyum.cn/index/" target="_blank" class="custom-link">我的博客</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    iOS面试题总结
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="ui.html">
            
                <a href="ui.html">
            
                    
                    1、UI视图相关面试题
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.2.1" data-path="UITableview.html">
            
                <a href="UITableview.html">
            
                    
                    1.1UITableview相关面试题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="shujutongbu.html">
            
                <a href="shujutongbu.html">
            
                    
                    1.2数据源同步
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="shijianchuandi.html">
            
                <a href="shijianchuandi.html">
            
                    
                    1.3UI事件传递与响应
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="tuxiangxianshi.html">
            
                <a href="tuxiangxianshi.html">
            
                    
                    1.4UI图像显示原理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="kadundiaozheng.html">
            
                <a href="kadundiaozheng.html">
            
                    
                    1.5UI卡顿掉帧原因
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="yibuhuizhi.html">
            
                <a href="yibuhuizhi.html">
            
                    
                    1.6异步绘制原理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="lipingxuanran.html">
            
                <a href="lipingxuanran.html">
            
                    
                    1.7离屏渲染
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../oc/2.html">
            
                <a href="../oc/2.html">
            
                    
                    2、OC语言
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../oc/2.1.html">
            
                <a href="../oc/2.1.html">
            
                    
                    2.1OC相关面试题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../oc/2.2.html">
            
                <a href="../oc/2.2.html">
            
                    
                    2.2分类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../oc/2_4.html">
            
                <a href="../oc/2_4.html">
            
                    
                    2.4扩展
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../oc/2.5.html">
            
                <a href="../oc/2.5.html">
            
                    
                    2.5代理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../oc/2.6.html">
            
                <a href="../oc/2.6.html">
            
                    
                    2.6通知
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="../oc/2.7.html">
            
                <a href="../oc/2.7.html">
            
                    
                    2.7KVO
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" data-path="../oc/2.8.html">
            
                <a href="../oc/2.8.html">
            
                    
                    2.8KVC
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.8" data-path="../oc/2.9.html">
            
                <a href="../oc/2.9.html">
            
                    
                    2.9属性关键字
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../runtime/3.html">
            
                <a href="../runtime/3.html">
            
                    
                    3、Runtime
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../runtime/3.1.html">
            
                <a href="../runtime/3.1.html">
            
                    
                    3.1对象、类对象、元类对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../runtime/3.2.html">
            
                <a href="../runtime/3.2.html">
            
                    
                    3.2消息传递机制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../runtime/3.3.html">
            
                <a href="../runtime/3.3.html">
            
                    
                    3.3消息转发流程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../runtime/3.4.html">
            
                <a href="../runtime/3.4.html">
            
                    
                    3.4Method-Swizzling
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../neicun/4.html">
            
                <a href="../neicun/4.html">
            
                    
                    4、内存
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../neicun/4.1.html">
            
                <a href="../neicun/4.1.html">
            
                    
                    4.1引用计数表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../neicun/4.2.html">
            
                <a href="../neicun/4.2.html">
            
                    
                    4.2弱引用表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../neicun/4.3.html">
            
                <a href="../neicun/4.3.html">
            
                    
                    4.3ARC、MRC
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../neicun/4.4.html">
            
                <a href="../neicun/4.4.html">
            
                    
                    4.4循环引用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../neicun/4.5.html">
            
                <a href="../neicun/4.5.html">
            
                    
                    4.5内存管理
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../block/5.html">
            
                <a href="../block/5.html">
            
                    
                    5、Block
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../block/5.1.html">
            
                <a href="../block/5.1.html">
            
                    
                    5.1Block本质
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../block/5.2.html">
            
                <a href="../block/5.2.html">
            
                    
                    5.2截获变量特性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../block/5.3.html">
            
                <a href="../block/5.3.html">
            
                    
                    5.3内存管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../block/5.4.html">
            
                <a href="../block/5.4.html">
            
                    
                    5.4循环引用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../duoxiancheng/6.html">
            
                <a href="../duoxiancheng/6.html">
            
                    
                    6、多线程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../duoxiancheng/6.1.html">
            
                <a href="../duoxiancheng/6.1.html">
            
                    
                    6.1GCD、nsoperation
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../duoxiancheng/6.2.html">
            
                <a href="../duoxiancheng/6.2.html">
            
                    
                    6.2资源共享
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../duoxiancheng/6.3.html">
            
                <a href="../duoxiancheng/6.3.html">
            
                    
                    6.3线程同步
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../duoxiancheng/6.4.html">
            
                <a href="../duoxiancheng/6.4.html">
            
                    
                    6.4SpinLock等
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../runloop/7.md">
            
                <span>
            
                    
                    7、RunLoop
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../runloop/7.1.md">
            
                <span>
            
                    
                    7.1事件循环
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../runloop/7.2.md">
            
                <span>
            
                    
                    7.2用户态
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../runloop/7.3.md">
            
                <span>
            
                    
                    7.3核心态
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="../runloop/7.4.md">
            
                <span>
            
                    
                    7.4常驻线程
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../network/8.md">
            
                <span>
            
                    
                    8、网络
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../network/8.1.md">
            
                <span>
            
                    
                    8.1HTTPS
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" data-path="../network/8.2.md">
            
                <span>
            
                    
                    8.2对称加密算法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.3" data-path="../network/8.3.md">
            
                <span>
            
                    
                    8.3非对称加密
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4" data-path="../network/8.4.md">
            
                <span>
            
                    
                    8.4DNS解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.5" data-path="../network/8.5.md">
            
                <span>
            
                    
                    8.5HTTP、TCP
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >1.1UITableview相关面试题</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><ul><ul><li><span class="title-icon "></span><a href="#111&#x91CD;&#x7528;&#x673A;&#x5236;&#x5B57;&#x6BCD;&#x7D22;&#x5F15;&#x6761;"><b></b>1.1.1&#x91CD;&#x7528;&#x673A;&#x5236;(&#x5B57;&#x6BCD;&#x7D22;&#x5F15;&#x6761;)</a></li><li><span class="title-icon "></span><a href="#112-uitableview-&#x7684;&#x6ED1;&#x52A8;&#x4F18;&#x5316;&#x65B9;&#x6848;"><b></b>1.1.2 UITableView &#x7684;&#x6ED1;&#x52A8;&#x4F18;&#x5316;&#x65B9;&#x6848;</a></li></ul></ul></ul></div><a href="#" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h3 id="111&#x91CD;&#x7528;&#x673A;&#x5236;&#x5B57;&#x6BCD;&#x7D22;&#x5F15;&#x6761;"><a name="111&#x91CD;&#x7528;&#x673A;&#x5236;&#x5B57;&#x6BCD;&#x7D22;&#x5F15;&#x6761;" class="anchor-navigation-ex-anchor" href="#111&#x91CD;&#x7528;&#x673A;&#x5236;&#x5B57;&#x6BCD;&#x7D22;&#x5F15;&#x6761;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="111&#x91CD;&#x7528;&#x673A;&#x5236;&#x5B57;&#x6BCD;&#x7D22;&#x5F15;&#x6761;" class="plugin-anchor" href="#111&#x91CD;&#x7528;&#x673A;&#x5236;&#x5B57;&#x6BCD;&#x7D22;&#x5F15;&#x6761;"><i class="fa fa-link" aria-hidden="true"></i></a>1.1.1&#x91CD;&#x7528;&#x673A;&#x5236;(&#x5B57;&#x6BCD;&#x7D22;&#x5F15;&#x6761;)</h3>
<pre><code class="lang-objective-c">    //&#x91CD;&#x7528;
    static NSString *cellID = @&quot;cell&quot;;
      //&#x6839;&#x636E;identify&#x5728;&#x7F13;&#x5B58;&#x7684;&#x5B57;&#x5178;&#x4E2D;&#x627E;&#x662F;&#x5426;&#x6709;&#x5DF2;&#x7ECF;&#x521D;&#x59CB;&#x5316;&#x597D;&#x7684;cell
      UITableView *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
        if (!cell) {
            cell = [[HORTransitReportCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:cellID];
        }
      return cell;

 //2.&#x6CE8;&#x518C;&#x65B9;&#x5F0F;
  [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier: identifier] ;

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    // &#x91CD;&#x7528;&#x961F;&#x5217;&#x4E2D;&#x53D6;&#x5355;&#x5143;&#x683C; &#x7531;&#x4E8E;&#x4E0A;&#x9762;&#x5DF2;&#x7ECF;&#x6CE8;&#x518C;&#x8FC7;&#x5355;&#x5143;&#x683C;,&#x7CFB;&#x7EDF;&#x4F1A;&#x5E2E;&#x6211;&#x4EEC;&#x505A;&#x5224;&#x65AD;,&#x4E0D;&#x7528;&#x518D;&#x6B21;&#x624B;&#x52A8;&#x5224;&#x65AD;&#x5355;&#x5143;&#x683C;&#x662F;&#x5426;&#x5B58;&#x5728;
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: identifier forIndexPath:indexPath] ;
    return cell ;
}
![](/img/ui-1.png)
</code></pre>
<pre><code>//  &#x5F53;&#x9875;&#x9762;&#x62C9;&#x52A8;&#x9700;&#x8981;&#x663E;&#x793A;&#x65B0;&#x6570;&#x636E;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x628A;&#x6700;&#x540E;&#x4E00;&#x4E2A;cell&#x8FDB;&#x884C;&#x5220;&#x9664; &#x5C31;&#x6709;&#x53EF;&#x4EE5;&#x81EA;&#x5B9A;&#x4E49;cell &#x6B64;&#x65B9;&#x6848;&#x5373;&#x53EF;&#x907F;&#x514D;&#x91CD;&#x590D;&#x663E;&#x793A;&#xFF0C;&#x53C8;&#x91CD;&#x7528;&#x4E86;cell&#x76F8;&#x5BF9;&#x5185;&#x5B58;&#x7BA1;&#x7406;&#x6765;&#x8BF4;&#x662F;&#x6700;&#x597D;&#x7684;&#x65B9;&#x6848; &#x524D;&#x4E24;&#x8005;&#x76F8;&#x5BF9;&#x6BD4;&#x8F83;&#x6D88;&#x8017;&#x5185;&#x5B58;
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    // &#x5B9A;&#x4E49;&#x552F;&#x4E00;&#x6807;&#x8BC6;
    static NSString *CellIdentifier = @&quot;Cell&quot;;
    // &#x901A;&#x8FC7;&#x552F;&#x4E00;&#x6807;&#x8BC6;&#x521B;&#x5EFA;cell&#x5B9E;&#x4F8B;
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    // &#x5224;&#x65AD;&#x4E3A;&#x7A7A;&#x8FDB;&#x884C;&#x521D;&#x59CB;&#x5316;  --&#xFF08;&#x5F53;&#x62C9;&#x52A8;&#x9875;&#x9762;&#x663E;&#x793A;&#x8D85;&#x8FC7;&#x4E3B;&#x9875;&#x9762;&#x5185;&#x5BB9;&#x7684;&#x65F6;&#x5019;&#x5C31;&#x4F1A;&#x91CD;&#x7528;&#x4E4B;&#x524D;&#x7684;cell&#xFF0C;&#x800C;&#x4E0D;&#x4F1A;&#x518D;&#x6B21;&#x521D;&#x59CB;&#x5316;&#xFF09;
    if (!cell) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
    }
    else//&#x5F53;&#x9875;&#x9762;&#x62C9;&#x52A8;&#x7684;&#x65F6;&#x5019; &#x5F53;cell&#x5B58;&#x5728;&#x5E76;&#x4E14;&#x6700;&#x540E;&#x4E00;&#x4E2A;&#x5B58;&#x5728; &#x628A;&#x5B83;&#x8FDB;&#x884C;&#x5220;&#x9664;&#x5C31;&#x51FA;&#x6765;&#x4E00;&#x4E2A;&#x72EC;&#x7279;&#x7684;cell&#x6211;&#x4EEC;&#x5728;&#x8FDB;&#x884C;&#x6570;&#x636E;&#x914D;&#x7F6E;&#x5373;&#x53EF;&#x907F;&#x514D;
    {
        while ([cell.contentView.subviews lastObject] != nil) {
            [(UIView *)[cell.contentView.subviews lastObject] removeFromSuperview];
        }
    }
    // &#x5BF9;cell &#x8FDB;&#x884C;&#x7B80;&#x5355;&#x5730;&#x6570;&#x636E;&#x914D;&#x7F6E;
    cell.textLabel.text = @&quot;text&quot;;
    cell.detailTextLabel.text = @&quot;text&quot;;
    cell.imageView.image = [UIImage imageNamed:@&quot;4.png&quot;];

    return cell;
}
</code></pre><p>///&#x91CD;&#x7528;&#x5B9E;&#x73B0;&#x5206;&#x6790;</p>
<p>&#x3000;&#x3000;&#x67E5;&#x770B;UITableView&#x5934;&#x6587;&#x4EF6;&#xFF0C;&#x4F1A;&#x627E;&#x5230;NSMutableArray<em>  visiableCells&#xFF0C;&#x548C;NSMutableDictnery</em> reusableTableCells&#x4E24;&#x4E2A;&#x7ED3;&#x6784;&#x3002;visiableCells&#x5185;&#x4FDD;&#x5B58;&#x5F53;&#x524D;&#x663E;&#x793A;&#x7684;cells&#xFF0C;reusableTableCells&#x4FDD;&#x5B58;&#x53EF;&#x91CD; &#x7528;&#x7684;cells&#x3002;</p>
<p>&#x3000;&#x3000;TableView&#x663E;&#x793A;&#x4E4B;&#x521D;&#xFF0C;reusableTableCells&#x4E3A;&#x7A7A;&#xFF0C;&#x90A3;&#x4E48;tableView dequeueReusableCellWithIdentifier:CellIdentifier&#x8FD4;&#x56DE;nil&#x3002;&#x5F00;&#x59CB;&#x7684;cell&#x90FD;&#x662F;&#x901A;&#x8FC7; [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]&#x6765;&#x521B;&#x5EFA;&#xFF0C;&#x800C;&#x4E14;cellForRowAtIndexPath&#x53EA;&#x662F;&#x8C03;&#x7528;&#x6700;&#x5927;&#x663E;&#x793A;cell&#x6570;&#x7684; &#x6B21;&#x6570;&#x3002;</p>
<p>&#x3000;&#x3000;&#x6BD4;&#x5982;&#xFF1A;&#x6709;100&#x6761;&#x6570;&#x636E;&#xFF0C;iPhone&#x4E00;&#x5C4F;&#x6700;&#x591A;&#x663E;&#x793A;10&#x4E2A;cell&#x3002;&#x7A0B;&#x5E8F;&#x6700;&#x5F00;&#x59CB;&#x663E;&#x793A;TableView&#x7684;&#x60C5;&#x51B5;&#x662F;&#xFF1A;</p>
<p>&#x3000;&#x3000;1. &#x7528;[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]&#x521B;&#x5EFA;10&#x6B21;cell&#xFF0C;&#x5E76;&#x7ED9;cell&#x6307;&#x5B9A;&#x540C;&#x6837;&#x7684;&#x91CD;&#x7528;&#x6807;&#x8BC6;(&#x5F53;&#x7136;&#xFF0C;&#x53EF;&#x4EE5;&#x4E3A;&#x4E0D;&#x540C;&#x663E;&#x793A;&#x7C7B;&#x578B;&#x7684; cell&#x6307;&#x5B9A;&#x4E0D;&#x540C;&#x7684;&#x6807;&#x8BC6;)&#x3002;&#x5E76;&#x4E14;10&#x4E2A;cell&#x5168;&#x90E8;&#x90FD;&#x52A0;&#x5165;&#x5230;visiableCells&#x6570;&#x7EC4;&#xFF0C;reusableTableCells&#x4E3A;&#x7A7A;&#x3002;</p>
<p>&#x3000;&#x3000;2. &#x5411;&#x4E0B;&#x62D6;&#x52A8;tableView&#xFF0C;&#x5F53;cell1&#x5B8C;&#x5168;&#x79FB;&#x51FA;&#x5C4F;&#x5E55;&#xFF0C;&#x5E76;&#x4E14;cell11(&#x5B83;&#x4E5F;&#x662F;alloc&#x51FA;&#x6765;&#x7684;&#xFF0C;&#x539F;&#x56E0;&#x540C;&#x4E0A;)&#x5B8C;&#x5168;&#x663E;&#x793A;&#x51FA;&#x6765;&#x7684;&#x65F6;&#x5019;&#x3002;cell11&#x52A0;&#x5165;&#x5230; visiableCells&#xFF0C;cell1&#x79FB;&#x51FA;visiableCells&#xFF0C;cell1&#x52A0;&#x5165;&#x5230;reusableTableCells&#x3002;</p>
<p>&#x3000;&#x3000;3. &#x63A5;&#x7740;&#x5411;&#x4E0B;&#x62D6;&#x52A8;tableView&#xFF0C;&#x56E0;&#x4E3A;reusableTableCells&#x4E2D;&#x5DF2;&#x7ECF;&#x6709;&#x503C;&#xFF0C;&#x6240;&#x4EE5;&#xFF0C;&#x5F53;&#x9700;&#x8981;&#x663E;&#x793A;&#x65B0;&#x7684; cell&#xFF0C;cellForRowAtIndexPath&#x518D;&#x6B21;&#x88AB;&#x8C03;&#x7528;&#x7684;&#x65F6;&#x5019;&#xFF0C;tableView dequeueReusableCellWithIdentifier:CellIdentifier&#xFF0C;&#x8FD4;&#x56DE;cell1&#x3002;cell1&#x52A0;&#x5165;&#x5230; visiableCells&#xFF0C;cell1&#x79FB;&#x51FA;reusableTableCells&#xFF1B;cell2&#x79FB;&#x51FA;visiableCells&#xFF0C;cell2&#x52A0;&#x5165;&#x5230; reusableTableCells&#x3002;&#x4E4B;&#x540E;&#x518D;&#x9700;&#x8981;&#x663E;&#x793A;&#x7684;Cell&#x5C31;&#x53EF;&#x4EE5;&#x6B63;&#x5E38;&#x91CD;&#x7528;&#x4E86;&#x3002;</p>
<p>&#x3000;&#x3000;&#x6240;&#x4EE5;&#x6574;&#x4E2A;&#x8FC7;&#x7A0B;&#x5E76;&#x4E0D;&#x96BE;&#x7406;&#x89E3;&#xFF0C;&#x4F46;&#x9700;&#x8981;&#x6CE8;&#x610F;&#x6B63;&#x662F;&#x56E0;&#x4E3A;&#x8FD9;&#x6837;&#x7684;&#x539F;&#x56E0;&#xFF1A;&#x914D;&#x7F6E;Cell&#x7684;&#x65F6;&#x5019;&#x4E00;&#x5B9A;&#x8981;&#x6CE8;&#x610F;&#xFF0C;&#x5BF9;&#x53D6;&#x51FA;&#x7684;&#x91CD;&#x7528;&#x7684;cell&#x505A;&#x91CD;&#x65B0;&#x8D4B;&#x503C;&#xFF0C;&#x4E0D;&#x8981;&#x9057;&#x7559;&#x8001;&#x6570;&#x636E;&#x3002;</p>
<p>&#x4E00;&#x4E9B;&#x60C5;&#x51B5;</p>
<p>&#x3000;&#x3000;&#x4F7F;&#x7528;&#x8FC7;&#x7A0B;&#x4E2D;&#xFF0C;&#x6211;&#x6CE8;&#x610F;&#x5230;&#xFF0C;&#x5E76;&#x4E0D;&#x662F;&#x53EA;&#x6709;&#x62D6;&#x52A8;&#x8D85;&#x51FA;&#x5C4F;&#x5E55;&#x7684;&#x65F6;&#x5019;&#x624D;&#x4F1A;&#x66F4;&#x65B0;reusableTableCells&#x8868;&#xFF0C;&#x8FD8;&#x6709;&#xFF1A;</p>
<p>&#x3000;&#x3000;1. reloadData&#xFF0C;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#x6BD4;&#x8F83;&#x7279;&#x6B8A;&#x3002;&#x4E00;&#x822C;&#x662F;&#x90E8;&#x5206;&#x6570;&#x636E;&#x53D1;&#x751F;&#x53D8;&#x5316;&#xFF0C;&#x9700;&#x8981;&#x91CD;&#x65B0;&#x5237;&#x65B0;cell&#x663E;&#x793A;&#x7684;&#x5185;&#x5BB9;&#x65F6;&#x8C03;&#x7528;&#x3002;&#x5728; cellForRowAtIndexPath&#x8C03;&#x7528;&#x4E2D;&#xFF0C;&#x6240;&#x6709;cell&#x90FD;&#x662F;&#x91CD;&#x7528;&#x7684;&#x3002;&#x6211;&#x4F30;&#x8BA1;reloadData&#x8C03;&#x7528;&#x540E;&#xFF0C;&#x628A;visiableCells&#x4E2D;&#x6240;&#x6709; cell&#x79FB;&#x5165;reusableTableCells&#xFF0C;visiableCells&#x6E05;&#x7A7A;&#x3002;cellForRowAtIndexPath&#x8C03;&#x7528;&#x540E;&#xFF0C;&#x518D;&#x628A; reuse&#x7684;cell&#x4ECE;reusableTableCells&#x53D6;&#x51FA;&#x6765;&#xFF0C;&#x653E;&#x5165;&#x5230;visiableCells&#x3002;</p>
<p>&#x3000;&#x3000;2. reloadRowsAtIndex&#xFF0C;&#x5237;&#x65B0;&#x6307;&#x5B9A;&#x7684;IndexPath&#x3002;&#x5982;&#x679C;&#x8C03;&#x7528;&#x65F6;reusableTableCells&#x4E3A;&#x7A7A;&#xFF0C;&#x90A3;&#x4E48; cellForRowAtIndexPath&#x8C03;&#x7528;&#x540E;&#xFF0C;&#x662F;&#x65B0;&#x521B;&#x5EFA;cell&#xFF0C;&#x65B0;&#x7684;cell&#x52A0;&#x5165;&#x5230;visiableCells&#x3002;&#x8001;&#x7684;cell&#x79FB;&#x51FA; visiableCells&#xFF0C;&#x52A0;&#x5165;&#x5230;reusableTableCells&#x3002;&#x4E8E;&#x662F;&#xFF0C;&#x4E4B;&#x540E;&#x7684;&#x5237;&#x65B0;&#x5C31;&#x6709;cell&#x505A;reuse&#x4E86;&#x3002;
 ///</p>
<h3 id="112-uitableview-&#x7684;&#x6ED1;&#x52A8;&#x4F18;&#x5316;&#x65B9;&#x6848;"><a name="112-uitableview-&#x7684;&#x6ED1;&#x52A8;&#x4F18;&#x5316;&#x65B9;&#x6848;" class="anchor-navigation-ex-anchor" href="#112-uitableview-&#x7684;&#x6ED1;&#x52A8;&#x4F18;&#x5316;&#x65B9;&#x6848;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="112-uitableview-&#x7684;&#x6ED1;&#x52A8;&#x4F18;&#x5316;&#x65B9;&#x6848;" class="plugin-anchor" href="#112-uitableview-&#x7684;&#x6ED1;&#x52A8;&#x4F18;&#x5316;&#x65B9;&#x6848;"><i class="fa fa-link" aria-hidden="true"></i></a>1.1.2 UITableView &#x7684;&#x6ED1;&#x52A8;&#x4F18;&#x5316;&#x65B9;&#x6848;</h3>
<p>&#x4E86;&#x89E3;&#x4EE5;&#x4E0A;&#x5185;&#x5BB9;&#x4E4B;&#x540E;&#xFF0C;&#x95EE;&#x9898;&#x6765;&#x4E86;&#xFF0C;&#x5BF9;&#x4E8E; UITableView &#x6709;&#x54EA;&#x4E9B;&#x4F18;&#x5316;&#x65B9;&#x6848;&#xFF1F;</p>
<p>&#x6211;&#x4EEC;&#x5C31;&#x53EF;&#x4EE5;&#x57FA;&#x4E8E; GPU &#x548C; CPU &#x8FD9;&#x4FE9;&#x65B9;&#x9762;&#x6765;&#x8FDB;&#x884C;&#x89E3;&#x7B54;</p>
<h4 id="cpu"><a name="cpu" class="anchor-navigation-ex-anchor" href="#cpu"><i class="fa fa-link" aria-hidden="true"></i></a><a name="cpu" class="plugin-anchor" href="#cpu"><i class="fa fa-link" aria-hidden="true"></i></a>CPU</h4>
<p>&#x5BF9;&#x8C61;&#x521B;&#x5EFA;&#xFF0C;&#x8C03;&#x6574;&#xFF0C;&#x9500;&#x6BC1;</p>
<p>&#x9884;&#x6392;&#x7248;(&#x5E03;&#x5C40;&#x8BA1;&#x7B97;&#xFF0C;&#x6587;&#x672C;&#x8BA1;&#x7B97;)</p>
<p>&#x9884;&#x6E32;&#x67D3;(&#x6587;&#x672C;&#x5F02;&#x6B65;&#x7ED8;&#x5236;(&#x4E0B;&#x9762;&#x4F1A;&#x63D0;&#x5230;)&#xFF0C;&#x56FE;&#x7247;&#x7F16;&#x89E3;&#x7801;&#x7B49;)</p>
<p>&#x50CF;&#x5BF9;&#x8C61;&#x521B;&#x5EFA;&#xFF0C;&#x5E03;&#x5C40;&#x8BA1;&#x7B97;&#x7B49;&#x90FD;&#x53EF;&#x4EE5;&#x653E;&#x5230;&#x5B50;&#x7EBF;&#x7A0B;&#x53BB;&#x505A;&#xFF0C;&#x4E3B;&#x7EBF;&#x7A0B;&#x53EF;&#x4EE5;&#x6709;&#x66F4;&#x591A;&#x7684;&#x65F6;&#x95F4;&#x53BB;&#x54CD;&#x5E94;&#x7528;&#x6237;&#x7684;&#x4EA4;&#x4E92;</p>
<h4 id="gpu"><a name="gpu" class="anchor-navigation-ex-anchor" href="#gpu"><i class="fa fa-link" aria-hidden="true"></i></a><a name="gpu" class="plugin-anchor" href="#gpu"><i class="fa fa-link" aria-hidden="true"></i></a>GPU</h4>
<p>&#x7EB9;&#x7406;&#x6E32;&#x67D3;</p>
<p>&#x6BD4;&#x5982;&#x4E00;&#x4E9B;&#x5706;&#x89D2;&#x548C;&#x9634;&#x5F71;&#x7684;&#x8BBE;&#x7F6E;&#xFF0C;&#x5BB9;&#x6613;&#x89E6;&#x53D1;&#x79BB;&#x5C4F;&#x6E32;&#x67D3;,&#x5BFC;&#x81F4;GPU&#x5DE5;&#x4F5C;&#x91CF;&#x975E;&#x5E38;&#x5927;, &#x8FD9;&#x662F;&#x4E00;&#x4E2A;&#x4F18;&#x5316;&#x70B9;.&#x5C3D;&#x91CF;&#x907F;&#x514D;&#x79BB;&#x5C4F;&#x6E32;&#x67D3;&#xFF0C;&#x51CF;&#x8F7B;GPU&#x7684;&#x538B;&#x529B;&#x3002;&#x8BE6;&#x7EC6;&#x5728;&#x540E;&#x4E00;&#x4E2A;&#x70B9;&#x4E13;&#x95E8;&#x8BB2;&#x4E00;&#x4E0B;</p>
<p>&#x89C6;&#x56FE;&#x6DF7;&#x5408;</p>
<p>&#x5F53;&#x6709;&#x591A;&#x4E2A;&#x89C6;&#x56FE;&#x5C42;&#x5C42;&#x53E0;&#x52A0;&#xFF0C;&#x89C6;&#x56FE;&#x5408;&#x6210;&#xFF0C;&#x6BCF;&#x4E00;&#x4E2A;&#x50CF;&#x7D20;&#x7684;&#x5408;&#x6210;&#x5BF9;&#x5E94;&#x7684;&#x50CF;&#x7D20;&#x503C;&#xFF0C;&#x9700;&#x8981;&#x8FDB;&#x884C;&#x5927;&#x91CF;&#x7684;&#x8BA1;&#x7B97;&#x3002;&#x53EF;&#x4EE5;&#x5728;&#x4E00;&#x5B9A;&#x7A0B;&#x5EA6;&#x4E0A;&#x51CF;&#x8F7B;&#x56FE;&#x5C42;&#x7684;&#x590D;&#x6742;&#x5EA6;, &#x901A;&#x8FC7;CPU&#x5C42;&#x9762;&#x7684;&#x5F02;&#x6B65;&#x7ED8;&#x5236;&#x673A;&#x5236;&#xFF0C;&#x8FBE;&#x5230;&#x63D0;&#x4EA4;&#x7684;&#x4F4D;&#x56FE;&#x672C;&#x8EAB;&#x662F;&#x4E00;&#x4E2A;&#x5C42;&#x7EA7;&#x5C11;&#x7684;&#x89C6;&#x56FE;.
&#x5177;&#x4F53;&#x4E8B;&#x4F8B;&#x53EF;&#x4EE5;&#x770B;&#x4E00;&#x4E0B;&#x8FD9;&#x91CC;</p>
<p><a href="https://blog.csdn.net/mo_xiao_mo/article/details/52622172" title="UITableView&#x7684;&#x4F18;&#x5316;&#x6280;&#x5DE7;&#xFF0D;&#x5F02;&#x6B65;&#x7ED8;&#x5236;Cell" target="_blank">UITableView&#x7684;&#x4F18;&#x5316;&#x6280;&#x5DE7;&#xFF0D;&#x5F02;&#x6B65;&#x7ED8;&#x5236;Cell</a></p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="ui.html" class="navigation navigation-prev " aria-label="Previous page: 1、UI视图相关面试题">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="shujutongbu.html" class="navigation navigation-next " aria-label="Next page: 1.2数据源同步">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"1.1UITableview相关面试题","level":"1.2.1","depth":2,"next":{"title":"1.2数据源同步","level":"1.2.2","depth":2,"path":"md/ui/shujutongbu.md","ref":"md/ui/shujutongbu.md","articles":[]},"previous":{"title":"1、UI视图相关面试题","level":"1.2","depth":1,"path":"md/ui/ui.md","ref":"md/ui/ui.md","articles":[{"title":"1.1UITableview相关面试题","level":"1.2.1","depth":2,"path":"md/ui/UITableview.md","ref":"md/ui/UITableview.md","articles":[]},{"title":"1.2数据源同步","level":"1.2.2","depth":2,"path":"md/ui/shujutongbu.md","ref":"md/ui/shujutongbu.md","articles":[]},{"title":"1.3UI事件传递与响应","level":"1.2.3","depth":2,"path":"md/ui/shijianchuandi.md","ref":"md/ui/shijianchuandi.md","articles":[]},{"title":"1.4UI图像显示原理","level":"1.2.4","depth":2,"path":"md/ui/tuxiangxianshi.md","ref":"md/ui/tuxiangxianshi.md","articles":[]},{"title":"1.5UI卡顿掉帧原因","level":"1.2.5","depth":2,"path":"md/ui/kadundiaozheng.md","ref":"md/ui/kadundiaozheng.md","articles":[]},{"title":"1.6异步绘制原理","level":"1.2.6","depth":2,"path":"md/ui/yibuhuizhi.md","ref":"md/ui/yibuhuizhi.md","articles":[]},{"title":"1.7离屏渲染","level":"1.2.7","depth":2,"path":"md/ui/lipingxuanran.md","ref":"md/ui/lipingxuanran.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["-sharing","splitter","expandable-chapters-small","anchors","github","github-buttons","donate","sharing-plus","anchor-navigation-ex","favicon","livereload"],"styles":{"website":"./styles/website.css","ebook":"styles/ebook.css","pdf":"styles/pdf.css","mobi":"styles/mobi.css","epub":"styles/epub.css"},"pluginsConfig":{"github":{"url":"https://github.com/zhou415770319"},"livereload":{},"splitter":{},"search":{},"sharing-plus":{"qq":false,"all":["facebook","google","twitter","instapaper","linkedin","pocket","stumbleupon"],"douban":false,"facebook":true,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":true,"messenger":false,"line":false,"vk":false,"pocket":true,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"donate":{"alipay":"../../img/alipay.JPG","alipayText":" ","button":"赞赏","title":"","wechat":"","wechatText":"微信打赏"},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":true,"showLevel":false},"favicon":{"shortcut":"./source/images/favicon.jpg","bookmark":"./source/images/favicon.jpg","appleTouch":"./source/images/apple-touch-icon.jpg","appleTouchMore":{"120x120":"./source/images/apple-touch-icon.jpg","180x180":"./source/images/apple-touch-icon.jpg"}},"github-buttons":{"buttons":[{"user":"zhou415770319","repo":"iosKnowledges","type":"star","size":"small","count":true}]},"expandable-chapters-small":{},"sharing":{"qq":false,"all":["google","facebook","weibo","twitter","qq","qzone","linkedin","pocket"],"douban":false,"facebook":false,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":false,"messenger":false,"line":false,"vk":false,"pocket":false,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchors":{}},"theme":"default","author":"zhoufei","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"zhoufei-iosknowledges","language":"zh-hans","links":{"sidebar":{"我的博客":"http://www.feiyum.cn/index/"}},"gitbook":"3.2.3","description":"ios面试知识点总结"},"file":{"path":"md/ui/UITableview.md","mtime":"2019-05-03T14:40:51.321Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-05-03T14:51:39.741Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-github-buttons/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-donate/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing-plus/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

